<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="vue.js"></script>
    <title>Document</title>
    <style>
        #long{
            width: 400px;
            height: 2px;
            border: 1px solid black;
            margin-top: 50px;
            position: relative;
        }
        #round{
           
            margin-top: 0;
            position: absolute;
        }
    
    </style>
</head>
<body>
    <main id="app">
        <input type="text" v-model="count">
        <first-com :total='total' :size='size' v-model="count"></first-com>
    </main>
    <script id="first" type="text/html">
         <section>
             <div id='long'>
                 <div @mousemove='changeValue' id='round' v-for='index in total' :style='starStyle'>○</div>
             </div>
         </section>
    </script>
    <script>
        Vue.component('first-com',{
            template:"#first",
            props:{
                total:{
                    type:Number,
                    default:1
                },
                size:{
                    type:Number,
                    default:40
                },
                value:{}
            },
            computed: {
                starStyle:function(){
                    return{
                        width:this.size + 'px',
                        height:this.size + 'px',
                        fontSize:this.size + 'px'
                    }
                }
            },
            methods: {
                changeValue:function(index){
                    
                   
                    this.$emit('input',index)
                }
            },

        })
        var vue = new Vue({
            el:"#app",
            data:{
               count:50,
               total:1,
               size:40
            }
        })
    </script>
</body>
</html>